package com.cskaoyan.exception;

import com.cskaoyan.bean.common.BaseRespVo;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 *  异常拦截组件
 *  作用范围是全局
 * @author wenkaikai
 * @since 2022/08/15 17:35
 */

@RestControllerAdvice
public class CustomExceptionControllerAdvice {

    @ExceptionHandler(ValidationException.class)
    public BaseRespVo validationException(ValidationException exception) {

        return BaseRespVo.invalidParameter(exception.getMessage());
    }
}